<?php

require_once("conn.php");
$db = new DBC();

$sql = "DELETE FROM t_game_resource_voice WHERE type = 'voice'";
$db->execute($sql);
                
$dir = "../game/voice";
if (is_dir($dir)) {
    if (($dir_handle = opendir($dir)) != false) {
        while (($file = readdir($dir_handle)) !== false) {
            if ($file != "." && $file != "..") {
                $code = explode(".", $file);
                $url = getDomain()."game/voice/" . $file;
                $sql = "INSERT INTO t_game_resource_voice(code,url,type,version,createTime) VALUES('" . $code[0] . "','" . $url . "','voice','1.0',now())";
                $db->execute($sql);
            }
        }
        closedir($dir_handle);
    }
}

echo "<script language='javascript'>location='questionVoiceList.php?menu=question';</script>";
?>
